package com.jbm.jbmsupplier.view;

import android.content.Context;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;


/**
 * Created by 家帮忙 on 2017/4/11.
 */

public class AdaViewHolder {
    private  View view;
    private  SparseArray<View>mViews;
    private int mPosition;


    public AdaViewHolder(int mPosition, Context context, ViewGroup parent, int layoutid) {
        this.mPosition = mPosition;
        mViews=new SparseArray<View>();
        view =View.inflate(context,layoutid,null);
        view.setTag(this);
    }


    public  static AdaViewHolder gettags(int mPosition, Context context, ViewGroup parent,int layoutid,View view){
        if (view==null){
            return new AdaViewHolder(mPosition,context,parent,layoutid);
        }
        return (AdaViewHolder)view.getTag();
    }
    public  View getviewc(){
        return view;

    }
    public <T extends View> T getview(int id){
        View viewid = mViews.get(id);
        if (viewid==null){
           viewid= viewid.findViewById(id);
            mViews.put(id,viewid);
        }
        return (T)viewid;
    }

}
